package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 *  对象流java.io.ObjectPOutputStream和 java.io.ObjectInputStream
 *  对象流是一对高级流,可以方便我们读写任何java 对象
 */
public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name = "张三";
        int age = 18;
        String gender = "男";

        String[] otherInfo = {"法外狂徒","可男可女"};
        Person p = new Person(name,age,gender,otherInfo);

        FileOutputStream fos = new FileOutputStream("Bfiles/person.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);

        oos.writeObject(p);
        System.out.println("写出完毕!");
        oos.close();
    }
}
